
#pragma once

#include "ITask.h"
#include "LuaEng.h"

#include "EventSystem.h"

#include <string>


//! This class represents a task which is in in charge of launching an event
//! after some time has elapsed.
//!
class TaskLaunchEvent : public ITask
{

	EventManager * mEventManager;
	Event::Ptr mEvent;

public:

	//! Constructs a TaskLaunchEvent
	//!
	//! @param eventManager Manager to which launch the event.
	//!	Must be non-null and remain valid while Execute may be called.
	//!
	//! @param ev Smart pointer to the event.
	TaskLaunchEvent(EventManager * eventManager, Event::Ptr ev)
		: mEventManager(eventManager), mEvent(ev)
	{
	}

	//! Launches the event
	//!
	virtual bool Execute()
	{
		mEventManager->QueueEvent(mEvent);
		return true;
	}

};